<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">

    <meta name="viewport" content="width=device-width"/>
    <meta name="viewport" content="initial-scale=1.0,user-scalable=no"/>
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name = "format-detection" content = "telephone=no">

    <link type="text/css" href="css/css.css" rel="stylesheet" />
    <title>注册</title>


 <script type="text/javascript">  
    //iOS Web APP中点击链接跳转到Safari 浏览器新标签页的问题 devework.com  
    //stanislav.it/how-to-prevent-ios-standalone-mode-web-apps-from-opening-links-in-safari  
    if(("standalone" in window.navigator) && window.navigator.standalone){  
        var noddy, remotes = false;  
        document.addEventListener('click', function(event) {  
            noddy = event.target;
            while(noddy.nodeName !== "A" && noddy.nodeName !== "HTML") {  
                noddy = noddy.parentNode;  
            }  
            if('href' in noddy && noddy.href.indexOf('http') !== -1 && (noddy.href.indexOf(document.location.host) !== -1 || remotes))  
            {  
                event.preventDefault();  
                document.location.href = noddy.href;  
            }  
        },false);  
    }  
  </script> 
</head>

<body>

<!--头部信息-->
    <div class="header">
        <table width="100%" border="0" cellspacing="0" class="header_nav">
        <tr>
            <td width="10%" class="nav_left1"><a  href='javascript:window.history.go(-1)'><</a></td>
            <td width="70%" class="nav_title">注册</td>
            <td width="20%" class="nav_r"></td>
        </tr>
        </table>
    </div>

<!--注册部分-->
    <div class="login">
        <div class="logo"></div>
        <div class="main">
            <table width="100%" border="0" cellspacing="0" class="main1">
                <tr>
                    <td class="text"><input type="text/css" id="username" class="text1" placeholder="请输入用户名"/></td>
                </tr>
            </table>
            <div class="linee"></div>
            <table width="100%" border="0" cellspacing="0" class="main1">
                <tr>
                    <td class="text"><input type="text/css" id="nickname" class="text1" placeholder="请输入昵称"/></td>
                </tr>
            </table>
            <div class="linee"></div>
            <table width="100%" border="0" cellspacing="0" class="main1">
                <tr>
                    <td class="text"><input type="text/css" id="email" class="text1" placeholder="请输入e-mail账号"/></td>
                </tr>
            </table>
            <div class="linee"></div>
            <table width="100%" border="0" cellspacing="0" class="main1">
                <tr>
                    <td class="text"><input type="text/css" id="telephone" class="text1" placeholder="请输入手机号"/></td>
                </tr>
            </table>
            <div class="linee"></div>
            <table width="100%" border="0" cellspacing="0" class="main1">
                <tr>
                    <td class="text"><input type="text/css" id="password" class="text1" placeholder="请输入密码"/></td>
                </tr>
            </table>
            <div class="linee"></div>
        </div>
        <div class="button"><input type="submit" onclick="javascript:zhuce()" value="注 册" class="text2" /></div>
            <!--需要与后台数据进行交互，将注册信息存入数据库中-->   
            <!--制作弹窗，或者一个倒计时返回页面，href=login.html-->
    </div>
<!--网站底部-->
    <!--<div class="footrt">
        <div class="footrt_left"><a href="login.html">已有账号？立即登录</a></div>
    </div>-->		
	<script src="js/jquery.min.js"></script>
	<script src="js/app.js"></script>
</body>

<script type="text/javascript">
	function zhuce(){
      	$.ajax({
            url: "http://libkindle.com:8080/WebSell/LoginServlet",
            type: 'GET',
            dataType: 'json',
            data: {
				action:"register",
            	username:$("#username").val(),
				nickname:$("#nickname").val(),
				email:$("#email").val(),
				telephone:$("#telephone").val(),
				password:$("#password").val()
            },
            success: function(data,status,xhr) {  
					if(data.code==1)
					{
					alert(data.msg);
					}
					else
					{
					alert(data.msg);
           			location.href = "login.html";          
					}
            },
            error: function() {
            	alert(data.msg);
            	window.location.href = "#";
            },
        });
    };
</script>


</html>
